package com.upb.webserver.common.enums;

/**
 * enum of regex pattern.
 */
public enum RegexPattern {

    IPV4("ipv4", "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$"),
    EMAIL("邮箱", "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"),
    MOBILE("电话号码", "^((13[0-9])|(14[0-9])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$"),
    ID_CARD("身份证", "(^\\d{18}$)|(^\\d{15}$)"),
    SIMPLE_STRING1("数字、字母或下划线", "^\\w+$");

    private String pattern;
    private String description;

    RegexPattern(String description, String pattern) {
        this.pattern = pattern;
        this.description = description;
    }

    public String getPattern() {
        return this.pattern;
    }
}
